home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ray Dream Studio
/
Ray Dream Studio (CDRAYD1) (Ray Dream) (1995).iso
/
DREAMSDK.WIN
/
INCLUDE
/
EVXALLOC.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1995-10-18
|
2KB
|
85 lines
/* $Id: EVXALLOC.CPP 1.11 1995/10/12 22:01:19 YannPC Exp $ */
#ifndef __EVXALLOC__
#include "EVXAlloc.h"
#endif
#ifndef __EVXAPI__
#include "EVXAPI.h"
#endif
#ifndef __EVDLLRT__
#include "EVDLLRT.h"
#endif
//#ifndef __STDDEF__
//#include <stddef.h>
//#endif
typedef unsigned int size_t;
#ifndef __MWERKS__
void* operator new(unsigned int byteCount) {
return EVXmalloc((size_t)byteCount);
}
#endif
#if defined(qPowerPC) || defined(__MWERKS__)
void* operator new(unsigned long byteCount) {
return EVXmalloc((size_t)byteCount);
}
#endif
void operator delete(void* block) {
EVXfree(block);
}
void* __vec_new(void* p, int nb, int size, void* cst) {
if (!p) {
p = EVXmalloc(nb*size);
}
if (p) {
int i;
char* pp = (char*)p;
for (i = 0; i < nb; i++) {
(*(void(*)(char*)) cst)(pp);
pp += size;
}
return p;
}
return 0;
}
void __vec_delete(void* p, int nb, int size, void* dst, int auto_delete_vec, int auto_delete) {
if (nb == -1) {
Failure(-108, 0);
}
if (p) {
int i;
char* pp;
pp = ((char*)p) + nb*size;
for (i = 0; i < nb; i++) {
pp -= size;
(*(void(*)(char*, long)) dst)(pp, auto_delete);
}
}
if (p && auto_delete_vec) {
EVXfree(p);
}
}
void* RDcalloc(unsigned long nmemb, unsigned long size) {
return EVXmalloc(nmemb * size);
}
void RDfree(void* ptr) {
EVXfree(ptr);
}
void* RDmalloc(unsigned long size) {
return EVXmalloc(size);
}
void* RDrealloc(void* ptr, unsigned long size) {
return EVXrealloc(ptr, size);
}